home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE02 / XTOOLS / XTOOL.ZIP / DBREMEMB.INT < prev    next >
Encoding:
Text File  |  1995-05-28  |  2.0 KB  |  58 lines

  1. {*******************************************************}
  2. {                                                       }
  3. {       xTool - Component Collection                    }
  4. {                                                       }
  5. {       Copyright (c) 1995 Stefan B÷ther                }
  6. {                                                       }
  7. {*******************************************************}
  8. unit DbRememb;
  9.  { remember various attributes of the an datasource
  10.    like order and widths in a data-grid }
  11.  
  12. interface
  13.  
  14. uses
  15.   WinTypes, WinProcs, SysUtils, Classes, Graphics, Dialogs,
  16.   Forms, Db, IniFiles;
  17.  
  18. type
  19.   TDbRememberOption  = (roIndex,roWidth);
  20.   TDbRememberOptions = set of TDbRememberOption;
  21.  
  22.   TDbRemember = class(TComponent)
  23.   private
  24.     FIniFile    : PString;
  25.     FSection    : PString;
  26.     FOnWrite    : TNotifyEvent;
  27.     FOnRead     : TNotifyEvent;
  28.     FNextDestroy: TNotifyEvent;
  29.     FNextCreate : TNotifyEvent;
  30.     FOptions    : TDbRememberOptions;
  31.     FDataSet    : TDataSet;
  32.     function    GetIniFile: String;
  33.     function    GetSection: String;
  34.     procedure   SetIniFile(Value: String);
  35.     procedure   SetSection(Value: String);
  36.     procedure   WriteRead(IsRead: Boolean);
  37.     procedure   FormCreate(Sender:TObject);
  38.     procedure   FormDestroy(Sender:TObject);
  39.   protected
  40.     FStorage    : TIniFile;
  41.     procedure   ReadState(Reader: TReader); override;
  42.   public
  43.     constructor Create(aOwner:TComponent); override;
  44.     destructor  Destroy; override;
  45.     procedure   Write; virtual;
  46.     procedure   Read; virtual;
  47.   published
  48.     property    DataSet: TDataset read FDataSet write FDataSet;
  49.     property    IniFile: String read GetIniFile write SetIniFile;
  50.     property    Section: String read GetSection write SetSection;
  51.     property    Options: TDbRememberOptions read FOptions write FOptions;
  52.     property    OnWrite: TNotifyEvent read FOnWrite write FOnWrite;
  53.     property    OnRead: TNotifyEvent read FOnRead write FOnRead;
  54.   end;
  55.  
  56.   procedure Register;
  57.  
  58.